<?php

/**
 * webpage to display and edit groups within va_stratlab database
 *
 * @author voellenk
 */

set_include_path(get_include_path(). PATH_SEPARATOR. 'inc/');
require_once 'inc/globals.secret.php';
function __autoload($class_name) {
  require_once $class_name.'.class.php';
}

session_start();

$page = new groupspage("va_stratlab groups page");
echo $page->htmlhead("va_stratlab.css");
echo $page->htmlbodytag();
//echo "<pre>"; print_r($_POST); echo "</pre>";

// connect to va_stratlab database
$mysql = new db($dbparams["host"].":".$dbparams["port"], $dbparams["user"], $dbparams["password"]);
$mysql->connect($dbparams["db"]);

if (empty ($_GET)) {
  $page->presetFormVariables();
} else {
  $page->parseGetVariable($_GET);
}

$page->initDb($mysql);
$page->processPostVariable($_POST);
$page->getGeneralDbInfos();


echo $page->titleBar();


if ($page->showgroup) {
  echo $page->group_member_edit_bar();
  echo "<p>".$page->dbopstring."</p>\n";
  echo $page->groupdetails();
} elseif ($page->showgroupoverview) {
  echo $page->group_edit_bar();
  echo "<p>".$page->dbopstring."</p>\n";
  echo $page->groupoverview();
} else {
  echo $page->error;
}

echo $page->htmlend();
$mysql->disconnect();
?>

